# -*- coding: utf-8 -*-
"""
@Time ： 2021/11/1 22:53
@Auth ： Mr.Kd 1548826452
@Company ：特斯汀学院 @testingedu.com.cn
@Function ：请输入模块功能描述
"""
import openpyxl

class Reader:
    def __init__(self):
        # 整个excel工作簿缓存
        self.workbook = None
    def openexcel(self,srcfile):
        openpyxl.Workbook.encoding = "utf8"
        self.workbook=openpyxl.load_workbook(srcfile)
        # print(self.workbook)
        return self.workbook
    def get_sheets(self):
        self.sheets=self.workbook.sheetnames
        # print(self.sheets)
        return self.sheets
    def set_sheets(self,name):
        self.sheet=self.workbook[name]
        # print(self.sheet)
        return self.sheet

    def readline(self):
        lines=[]
        for row in self.sheet.rows:
            line=[]
            for cell in row:
                if cell.value is None:
                    #pass
                    line.append('')
                else:
                    line.append(str(cell.value))
            print(line)
            lines.append(line)

        return lines
if __name__ == '__main__':
    r=Reader()

